import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceDetailVO, DeviceDetailForm, DeviceDetailQuery } from '@/api/system/DeviceDetail/types';

/**
 * 查询设备详细信息列表
 * @param query
 * @returns {*}
 */

export const listDeviceDetail = (query?: DeviceDetailQuery): AxiosPromise<DeviceDetailVO[]> => {
  return request({
    url: '/system/deviceDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备详细信息详细
 * @param productNumber
 */
export const getDeviceDetail = (productNumber: string | number): AxiosPromise<DeviceDetailVO> => {
  return request({
    url: '/system/deviceDetail/' + productNumber,
    method: 'get'
  });
};

/**
 * 新增设备详细信息
 * @param data
 */
export const addDeviceDetail = (data: DeviceDetailForm) => {
  return request({
    url: '/system/deviceDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备详细信息
 * @param data
 */
export const updateDeviceDetail = (data: DeviceDetailForm) => {
  return request({
    url: '/system/deviceDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备详细信息
 * @param productNumber
 */
export const delDeviceDetail = (productNumber: string | number | Array<string | number>) => {
  return request({
    url: '/system/deviceDetail/' + productNumber,
    method: 'delete'
  });
};
